package org.jeecg.model.basedata;

import lombok.Data;
import org.jeecg.entity.basedata.BaseArea;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
public class BaseAreaTree implements Serializable {
    private static final long serialVersionUID = 1L;

    private String id;

    private String parentId;
    private String parentIds;
    private String name;
    private String code;
    private String type;

    private String delFlag;

    private String createBy;

    private Date createTime;

    private String updateBy;

    private Date updateTime;

    //----------新加-------------------
    private String key;

    private String value;

    private String title;

    private List<BaseAreaTree> children;

    public BaseAreaTree(){}

    public BaseAreaTree(BaseArea baseArea){
        this.key = baseArea.getId();
        this.value = baseArea.getId();
        this.title = baseArea.getName();
        this.id = baseArea.getId();
        this.parentId = baseArea.getParentId();
        this.parentIds = baseArea.getParentIds();
        this.name = baseArea.getName();
        this.code = baseArea.getCode();
        this.type = baseArea.getType();
        this.delFlag = baseArea.getDelFlag();
        this.createBy = baseArea.getCreateBy();
        this.createTime = baseArea.getCreateTime();
        this.updateBy = baseArea.getUpdateBy();
        this.updateTime = baseArea.getUpdateTime();
        if (baseArea.getId().length() < 6){
            this.children = new ArrayList<BaseAreaTree>();
        }
    }

}
